package GuiUtils;

import java.awt.Color;
import java.awt.Dimension;
import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import net.miginfocom.swing.MigLayout;

public class SingleDateField extends JPanel {
    
    private JLabel label;
    public JFormattedTextField field;
    
    public SingleDateField(String labelText) {
     // For Locale.ENGLISH, the format would be Feb 8, 2002.
    // JFormattedTextField tft1 = new JFormattedTextField(new Date());
     //2/8/02.
    // JFormattedTextField tft2 = new JFormattedTextField(DateFormat.getDateInstance(DateFormat.SHORT));
//     tft2.setValue(new Date());
        
   // Format: 2002-8-2
        field = new JFormattedTextField(new SimpleDateFormat("yyyy-M-d"));
   //     tft3.setValue(new Date());
     // Retrieve the date from the text field
     // Date date = (Date)tft3.getValue();
        
        field.setColumns(10);
        setLayout(new MigLayout());
        label = new JLabel(labelText);
        add(label, "");
        add(field, "wrap");
    }
}
